package com.hnu.highlynewapp.app;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.hnu.highlynewapp.entity.PolicyCategoryIndexEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.hnu.highlynewapp.entity.ProfessionFieldIndexEntity;
import com.hnu.highlynewapp.service.ProfessionFieldIndexService;
import com.hnu.highlynewapp.utils.PageUtils;
import com.hnu.highlynewapp.utils.R;
import springfox.documentation.annotations.ApiIgnore;


/**
 * 行业领域检索
 *
 * @author hnu_worker
 * @email 825963704@qq.com
 * @date 2021-01-04 22:01:47
 */
@Api(tags = "检索字段api管理")
@RestController
@RequestMapping("/professionfieldindex")
public class ProfessionFieldIndexController {
    @Autowired
    private ProfessionFieldIndexService professionFieldIndexService;

    /**
     * 获取行业领域字段
     */
    @ApiOperation("获取行业领域字段")
    @GetMapping("/getlist")
    public R getList(){
        List<ProfessionFieldIndexEntity> list = professionFieldIndexService.list();

        return R.ok().put("data", list);
    }

    /**
     * 列表
     */
    @ApiIgnore
    @RequestMapping("/list")
    //@RequiresPermissions("highlynewapp:professionfieldindex:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = professionFieldIndexService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @ApiIgnore
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("highlynewapp:professionfieldindex:info")
    public R info(@PathVariable("id") Long id){
		ProfessionFieldIndexEntity professionFieldIndex = professionFieldIndexService.getById(id);

        return R.ok().put("professionFieldIndex", professionFieldIndex);
    }

    /**
     * 保存
     */
    @ApiIgnore
    @RequestMapping("/save")
    //@RequiresPermissions("highlynewapp:professionfieldindex:save")
    public R save(@RequestBody ProfessionFieldIndexEntity professionFieldIndex){
		professionFieldIndexService.save(professionFieldIndex);

        return R.ok();
    }

    /**
     * 修改
     */
    @ApiIgnore
    @RequestMapping("/update")
    //@RequiresPermissions("highlynewapp:professionfieldindex:update")
    public R update(@RequestBody ProfessionFieldIndexEntity professionFieldIndex){
		professionFieldIndexService.updateById(professionFieldIndex);

        return R.ok();
    }

    /**
     * 删除
     */
    @ApiIgnore
    @RequestMapping("/delete")
    //@RequiresPermissions("highlynewapp:professionfieldindex:delete")
    public R delete(@RequestBody Long[] ids){
		professionFieldIndexService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
